package com.qkl.user.dto;

import com.qkl.user.enums.ExceptionEnum;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data

@AllArgsConstructor //全参
public class ExceptionResponse  {
    private int code;
    private String message;
    private Object data;


    public static ExceptionResponse Success(Object data){
        ExceptionResponse response = new ExceptionResponse();
        response.setData(data);
        return response;
    }
    public static ExceptionResponse Success(){
        return new ExceptionResponse();
    }
    public static ExceptionResponse Success(String message){
        return new ExceptionResponse(ExceptionEnum.SUCCESS.getCode(), message);
    }
    public ExceptionResponse() {
        this.code = ExceptionEnum.SUCCESS.getCode();
        this.message = ExceptionEnum.SUCCESS.getMsg();
    }

    public ExceptionResponse(ExceptionEnum exceptionEnum) {
        this.code = exceptionEnum.getCode();
        this.message = exceptionEnum.getMsg();;
    }
    public ExceptionResponse(int code, String message) {
        this.code = code;
        this.message = message;
    }

}
